package com.example.springpethospital.mapper;

import com.example.springpethospital.entity.file.po.UploadTaskPO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UploadTaskMapper {

    @Insert("insert into upload_task(upload_id, file_identifier, file_name, bucket_name, object_key,"
        + "total_size, chunk_size, chunk_num) value(#{po.uploadId}, #{po.fileIdentifier}, #{po.fileName}, "
        + "#{po.bucketName}, #{po.objectKey}, #{po.totalSize}, #{po.chunkSize}, #{po.chunkNum})")
    int insert(@Param("po") UploadTaskPO po);

    @Select("select * from upload_task where file_identifier = #{identifier}")
    UploadTaskPO queryByIdentifier(@Param("identifier") String identifier);
}
